Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • trfletch 598 posts 604 karma points
    Apr 08, 2009 @ 19:09
    trfletch
    0

    Creating a page redirect using a Content Picker [SOLVED]

    Ok so here is the situation, I have a menu that is populated by sub nodes of a node. What I want to do is have more items in this menu that point to the same page for example say I have the following pages:

    Cats
    Dogs
    Horses

    I want to be able to add another item to my menu called "Felines" that points to the same page as "Cats". I would of course have to create another page called "Felines" that would redirect to my Cats page. So far I have created another Document Type called "Redirect" that contains a Content Picker, I can therefore create a new redirect page and select the "Cats" page using my content picker. The bit I am now struggling on is what to put in the template for my "Redirect" page to make it redirect to whatever is selected in the "Content Picker". I tried adding the following to my "Redirect" page template but of course the asp.net code does not recognise the Umbraco call to get the item field "Redirect", can anyone point me in the right direction?? Cheers


    [code]

    <script runat="server"> <br />
    void Page_Load(Object s, EventArgs e) <br />
    {<br />
    Response.Redirect("<asp:Content ContentPlaceHolderID='ContentPlaceHolderDefault' runat='server'><umbraco:Item field='redirect' runat='server'></umbraco:Item></asp:Content>");<br />
    }<br />
    </script>
    [/code]

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Apr 08, 2009 @ 20:26
    Dirk De Grave
    0

    Hi,

    Add an extra property to your doc type of 'Cats', 'Dogs' and 'Horses' (alias must be umbracoUrlName). Add another item 'Felines' and enter the 'Cats' (without the quotes) for the new property. It will change the url for that specific node to the same url for 'Cats'.
    Node name will not change...

    Regards,
    /Dirk

  • trfletch 598 posts 604 karma points
    Apr 08, 2009 @ 21:34
    trfletch
    0

    Hi Dirk,

    Thanks for this, I have just tested it and it works as you said, I just wondered if there was anyway that I could use the Content Picker instead of having to type in the name of the page I want it to link to? It's just that I know that typing a name correctly can sometimes be a problem for a user! I did try to make the umbracoUrlName field a "Content Picker" but it of course then returns the node ID rather than the name.

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Apr 08, 2009 @ 21:40
    Dirk De Grave
    0

    Hi,

    It might be possible, but you'll have to adapt the xslt for listing the menu... Check whether the content picker property has a value, and if so, use that value and NiceUrl() to create a link to that other node.

    [code][/code]

    Hope this helps.

    Regards,
    /Dirk

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Apr 08, 2009 @ 22:28
    Morten Bock
    0

    You could also create a property on your document type with a content picker, and give it the alias umbracoRedirect.

    Now create your Felines page, and select the Cats page with the content picker, and it will automagically redirect you when you visit the Felines page.

    You will then have a site like this

    Content
    - Home
    -- Cats
    -- Dogs
    -- Horses
    -- Felines (Cats page selected in umbracoRedirect property)

    This way you would not have to change your menu macro.

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Apr 09, 2009 @ 09:24
    Dirk De Grave
    0

    Yep, indeed, forgot about that, thanks for backing me up Morten,

    Cheers,
    /Dirk

  • trfletch 598 posts 604 karma points
    Apr 09, 2009 @ 10:30
    trfletch
    0

    Excellent that is exactly what I needed, thank you both for all your help. Is some sort of list somewhere with all these Umbraco commands etc so that I don't have to keep bothering you guys in future?

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Apr 09, 2009 @ 10:35
    Dirk De Grave
    0

    Hmm, not really, but it would be great idea to gather all those... I might get a list here for future reference...

    Cheers,
    /Dirk

  • trfletch 598 posts 604 karma points
    Apr 09, 2009 @ 14:53
    trfletch
    0

    I'm sure I read a post the other day from someone a while back who was claiming that they were going to create an umbraco knowlegebase website, I assume nothing come of it? It would be handy to have a list somewhere with all the different Umbraco functions including so XSLT commands that are useful.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies